home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
progjrn
/
pj_7_2.arc
/
PMDEV2.ARC
/
SPMTPLNT.C
< prev
next >
Wrap
Text File
|
1988-10-18
|
2KB
|
73 lines
#define INCL_PM
#include <os2.h>
#include <stddef.h>
#include "spmtpl.h"
BOOL FAR InitProgram(int argc, char *argv[])
{
char szTitle[50];
ULONG ctldata;
/* get anchor block handle and message queue handles */
if ((hAB = WinInitialize(NULL)) == NULL)
return FALSE;
if ((hmqMsgQ = WinCreateMsgQueue(hAB,0)) == NULL)
return FALSE;
/* This string is needed to register the Window */
WinLoadString(hAB,NULL, IDS_APPNAME, sizeof(szAppName), (PSZ)szAppName);
if (!WinRegisterClass(hAB, /* anchor block handle */
(PCH)szAppName, /* class name */
(PFNWP)MainWndProc, /* window procedure for class */
CS_SIZEREDRAW, /* class styles */
0)) /* no extra data needed */
return FALSE;
/* This string is needed to create the frame window */
WinLoadString(hAB, NULL, IDS_TITLE, sizeof(szTitle), (PSZ)szTitle);
ctldata = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX;
hwndFrame = WinCreateStdWindow(HWND_DESKTOP, /* parent */
WS_VISIBLE,
&ctldata,
(PCH)szAppName, /* class */
(PCH)szTitle, /* window title */
0L, /*default client style*/
(HMODULE)NULL, /* resources in .EXE */
NULL, /* frame id */
(HWND FAR *)&hwndMain);
/* handle to client */
if (hwndFrame) {
WinShowWindow(hwndFrame, TRUE);
return TRUE;
}
return FALSE;
}
/* called when client is created */
void FAR WndCreate(HWND hWnd)
{
FONTMETRICS FM;
HPS hPS;
/* get the size of an icon */
xIconsize = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
yIconsize = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
/* load the icon string */
WinLoadString(hAB, NULL, IDS_ICON, (USHORT)sizeof(szIcon), (PSZ)szIcon);
/* get the system font character metrics */
hPS = WinGetPS(hWnd);
GpiQueryFontMetrics(hPS, (LONG)sizeof(FONTMETRICS), &FM);
CharHeight = FM.lMaxBaselineExt + FM.lExternalLeading;
CharWidth = FM.lAveCharWidth;
WinReleasePS (hPS);
}